package com.ittable.rpcdemo.client;

import com.ittable.rpcdmeo.pojo.Element;
import com.ittable.rpcdmeo.service.HealthyService;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

import static com.ittable.rpcdmeo.constant.RmiConstant.RMI_NAME;

/**
 * @author srh
 * @date 2020/10/17
 **/
public class ClientMain {
    public static void main(String[] args) throws RemoteException, NotBoundException, MalformedURLException {
        // 在RMI服务注册表中查找名称为Healthy的对象，并调用其上的方法
        HealthyService service = (HealthyService) Naming.lookup(RMI_NAME);

        String status = service.getStatus(new Element());
        System.out.println(String.format("client getStatus = %s", status));
    }
}
